﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dropit.BlogPageProvider.WordPress
{
	public class WordPressId
	{
		public string BlogId
		{
			get;
			set;
		}

		public string PostId
		{
			get;
			set;
		}

		public string CommentId
		{
			get;
			set;
		}

		#region Methods

		public static bool TryParse(string data, out WordPressId id)
		{
			if (!string.IsNullOrEmpty(data))
			{
				string[] parts = data.Split('|');
				if (parts.Length == 3)
				{
					id = new WordPressId();
					id.BlogId = parts[0];
					id.PostId = parts[1];
					id.CommentId = parts[2];
					return true;
				}
			}
			id = null;
			return false;
		}

		public override string ToString()
		{
			return string.Format("{0}|{1}|{2}", BlogId, PostId, CommentId);
		}

		#endregion
	}
}
